<?php
class Pageley_Mapper_RegistryEntry implements Pageley_Domain_PropertyChangeListener {
	
	private $entity;
	private $state;
	
	public function __construct($entity, $state) {
		$this->entity = $entity;
		$this->entity->addPropertyChangeListener($this);
		$this->state = $state;
	}
	
	public function setState($state) {
		$this->state = $state;
	}
	
	public function getState() {
		return $this->state;
	}
	
	public function getEntity() {
		return $this->entity;
	}
	
	public function propertyChanged($event) {
		if($this->getState() == Pageley_Mapper_State::$CLEAN) {
			$this->setState(Pageley_Mapper_State::$UPDATED);
		}
	}
	
}